<h3>My Account</h3>
<?php
    echo FHtml::beginForm('','post', array('class' => 'form', 'id' => 'frmEditAccount'));
    FHtml::hightlightErrorFields();

    $user->scenario = 'editAccount';

    if (isset($errors)) echo FHtml::showErrors($errors);
    if (isset($message)) echo '<div style="font-weight: bold; padding-left: 165px;">'.$message.'</div>';
    ?>
        <div class="Input">
            <?php echo FHtml::activeHiddenField($user,'Id'); ?>
            <label for="User_Username">Username</label>
            <span style="line-height: 20px; font-weight: bold;margin: 3px 5px 0px 0px; background-color: none; display: block;"><?php echo FHtml::encode($user->Username); ?></span>
            <?php echo FHtml::activeHiddenField($user,'Username'); ?>
        </div>
        <div class="Input">
            <label for="User_FirstName">First name</label>
            <?php echo FHtml::activeTextField($user,'FirstName', array('class'=>'text')); ?>
        </div>
        <div class="Input">
            <label for="User_LastName">Last name</label>
            <?php echo FHtml::activeTextField($user,'LastName', array('class'=>'text')); ?>
        </div>
        <div class="Input">
            <label for="User_Username">Email</label>
            <?php echo FHtml::activeTextField($user,'Email', array('class'=>'text')); ?>
        </div>
        <div class="Input">
            <label for="">&nbsp;</label>
            <input type="checkbox" id="changePassword" /><span> I want to change my password</span>
        </div>
        <div class="Input Password" style="display:none">
            <label for="User_Username">Password</label>
            <?php echo FHtml::activePasswordField($user,'Password', array('value' => '')); ?>
        </div>
        <div class="Input Password" style="display:none">
            <label for="User_Username">Verify password</label>
            <?php echo FHtml::activePasswordField($user,'rePassword'); ?>
        </div>
        <div class="Action">
            <?php echo FHtml::submitButton('Save', array('class' => 'button')); ?>
        </div>
    <?php echo FHtml::endForm(); ?>
    <?php 
    //Remove the required validation on password field by default
    Yii::app()->ClientScript->registerScript('',"\$('#User_Password').rules('remove','required');", CClientScript::POS_READY); 
    ?>
    <script>
    $('#changePassword').click(function(){
        $('#User_Password').val('');
        if($('#changePassword')[0].checked){
            $('.Password').slideDown();
            $('#User_Password').rules('add','required');
        } else {
            $('.Password').slideUp();            
            $('#User_Password').rules('remove','required');
        }
    });
    </script>

<?php
$cs = Yii::app()->ClientScript;
$cs->registerScriptFile(Yii::app()->theme->BaseUrl.'/scripts/common.js', CClientScript::POS_BEGIN);
?>